﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Messenger.Utils
{
    public class AppConfiguration
    {
        private static readonly Lazy<AppConfiguration> instance = new Lazy<AppConfiguration>(() => 
        {
            if (File.Exists(AppConstants.ConfigFilePath))
            {
                YamlFileService<AppConfiguration> service = new YamlFileService<AppConfiguration>(AppConstants.ConfigFilePath);
                var result = service.Read();
                return result;
            }
            var config = new AppConfiguration();
            config.WriteConfigFile();

            return config;

        });
        public static AppConfiguration Instance => instance.Value;
        public AppConfiguration()
        {
            
        }
        public bool SkipBibSlotCheck { get; set; }
        public bool RecordTcp { get; set; }

        public bool SkipPowerBoardCheck { get; set; }

        public void WriteConfigFile()
        {
            YamlFileService<AppConfiguration> service = new YamlFileService<AppConfiguration>(AppConstants.ConfigFilePath);
            service.Write(this);
        }
    }
}
